<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>263.丑数</title>
</head>

<body>

</body>

<script>
    /**
     * @param {number} n
     * @return {boolean}
     */
    var isUgly = function (n) {
        let result = false;
        while (n > 1) {
            if (n % 2 === 0) {
                n = n / 2;
            } else if (n % 3 === 0) {
                n = n / 3;
            } else if (n % 5 === 0) {
                n = n / 5;
            } else {
                break;
            }
        }
        if (n === 1) {
            result = true;
        }
        return result;
    };
    console.log(isUgly(14));
</script>

</html>